import Mock from 'mockjs'
import userAPI from './user'
import carSourceApi from './carSource'
import carBusinessApi from './carBusiness'

// Fix an issue with setting withCredentials = true, cross-domain request lost cookies
// https://github.com/nuysoft/Mock/issues/300
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function() {
  if (this.custom.xhr) {
    this.custom.xhr.withCredentials = this.withCredentials || false
  }
  this.proxy_send(...arguments)
}
// Mock.setup({
//   timeout: '350-600'
// })

// User
// Mock.mock("/api/oauth/token", 'post', userAPI.login)
// Mock.mock("/api/web-api/getInfo", 'get', userAPI.getInfo)
// Mock.mock("/api/web-api/getRouters",'get',userAPI.getMenu)
// Mock.mock("/car/web-api/getRouters",'get',userAPI.getMenu)
// Mock.mock(/\/user\/logout/, 'post', userAPI.logout)

//carsource
// Mock.mock("/api/getShopList", 'post', carSourceApi.getShopList)
// Mock.mock("/api/editShop", 'post', carSourceApi.editShop)
// Mock.mock("/api/getStoreList", 'post', carSourceApi.getStoreList)
// //carbusiness
// Mock.mock("/api/getBusinessList", 'post', carBusinessApi.getBusinessList)

export default Mock
